Show:

Q columns Class

This tool contains functionality to show things in columns

Constructor

Q columns

(
  • [options]
)
Q.Tool

Parameters:

  • [options] Object optional

    Override various options for this tool

    • [title] String optional

      You can put a default title for all columns here (which is shown as they are loading)

    • [column] String optional

      You can put a default content for all columns here (which is shown as they are loading)

    • [controls] String optional

      You can put default controls HTML for all columns here (which is shown as they are loading)

    • [data] Object optional

      Any data you want to associate with the column, to be retrieved later by the tool.data() method

    • [attributes] Object optional

      Any attributes you want to add to the column element

    • [animation] Object optional

      For customizing animated transitions

      • [duration] Number optional
        The duration of the transition in milliseconds, defaults to 500
      • [hide] Object optional
        The css properties in "hide" state of animation
    • [back] Object optional

      For customizing the back button on mobile

      • [src] String optional
        The src of the image to use for the back button
      • [triggerFromTitle] Boolean optional
        Whether the whole title would be a trigger for the back button. Defaults to true.
      • [hide] Boolean optional
        Whether to hide the back button. Defaults to false, but you can pass true on android, for example.
    • [textfill={}] Object optional

      Options for Q/textfill on the title, or pass null here to skip this effect.

    • [close] Object optional

      For customizing the back button on desktop and tablet

      • [src] String optional
        The src of the image to use for the close button
      • [clickable] Object optional
        If not null, enables the Q/clickable tool with options from here. Defaults to null.
    • [scrollbarsAutoHide] Object optional

      If an object, enables Q/scrollbarsAutoHide functionality with options from here. Enabled by default.

    • [handlers] Object optional

      Pairs of columnName: handler where the handler can be a function or a string, in which you assign a function to Q.exports .

    • [fullscreen] Boolean optional

      Whether to use fullscreen mode on mobile phones, using document to scroll instead of relying on possibly buggy "overflow" CSS implementation. Defaults to true on Android stock browser, false everywhere else.

    • [hideBackgroundColumns=true] Boolean optional

      Whether to hide background columns on mobile (perhaps improving browser rendering).

    • [pagePushUrl] Boolean optional

      if this is true and the url of the column is specified, then Q.Page.push() is called with this URL.

    • [beforeOpen] Q.Event optional

      Event that happens before a column is opened. Return false to prevent opening. Receives (options, index).

    • [beforeClose] Q.Event optional

      Event that happens before a column is closed. Receives (index, indexAfterClose, columnElement). Return false to prevent closing.

    • [onOpen] Q.Event optional

      Event that happens after a column is opened. Receives (options, index, columnElement).

    • [afterDelay] Q.Event optional

      Event that happens after a column is opened, after a delay intended to wait out various animations. Receives (options, index, columnElement).

    • [onClose] Q.Event optional

      Event that happens after a column is closed.

Returns:

Item Index

Methods

Methods

close

(
  • index
  • callback
  • options
)
Boolean

Closes a column

Parameters:

  • index Number | Array | Object

    The index of the column to close. You can pass an array of indexes here, or an object with "min" and optional "max"

  • callback Function

    Called when the column is closed, or if no column Receives (index, column) where the column could be null if it wasn't found.

  • options Object

    Can be used to override some values taken from tool state

Returns:

Boolean:

Whether the column was actually closed.

open

(
  • options
  • index
  • callback
)
Boolean

Opens a column

Parameters:

  • options Object

    Can be used to override various tool options, including events such as "onOpen" and "onClose". Additional options include:

    • [name] String optional

      any name to assign to the column

    • [columnClass] String optional

      to add a class to the column

    • [data] Object optional

      to add data on the column element with jQuery

    • [template] Object optional

      template to render for the "column" slot

    • [fields] Object optional

      fields for the template, if any

    • [title] Object optional

      override the title of the column

    • [column] Object optional

      override the html of the column

    • [url] Object optional

      a url to request the slots "title" and "column" from

  • index Number

    The index of the column to open

  • callback Function

    Called when the column is opened

Returns:

Boolean:

Whether the column will be opened

pop

(
  • callback
  • options
)

Closes the last column

Parameters:

  • callback Function

    Called when the column is closed

  • options Object

    Can be used to override various tool options

push

(
  • options
  • callback
)

Opens a new column at the end

Parameters:

  • options Object

    Can be used to override various tool options

  • callback Function

    Called when the column is opened